﻿<local:LayoutAwarePage
    x:Class="NewsReaderApp.Views.SettingsPopups.SettingsPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:NewsReaderApp.Views"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="768"
    d:DesignWidth="346">

    <Border BorderBrush="{StaticResource ApplicationPageBackgroundDarkThemeBrush}" BorderThickness="1,0,0,0">
        <Grid Background="White" VerticalAlignment="Stretch">

            <!-- Root grid definition -->
            <Grid.RowDefinitions>
                <RowDefinition Height="80"/>
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>

            <!-- Header area for panel -->
            <Grid Background="{StaticResource ApplicationPageBackgroundDarkThemeBrush}" Grid.Row="0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>

                <StackPanel Orientation="Horizontal" Grid.Column="0" Margin="40, 32, 17, 13">
                    <Button Click="MySettingsBackClicked" Margin="0,3,0,0"  Style="{StaticResource SettingsBackButtonStyle}"/>
                    <TextBlock Margin="10,0,0,0" FontFamily="Segoe UI" FontWeight="SemiLight" FontSize="24.6667" 
                               Text="Settings" Foreground="White"/>
                </StackPanel>
            </Grid>

            <Grid Grid.Row="1"  Margin="20" VerticalAlignment="Top" Grid.RowSpan="3" x:Name="settingsPane">
                <StackPanel Orientation="Vertical">
                    <Border CornerRadius="3" BorderThickness=".5" BorderBrush="Blue"  Margin="2,10,2,10">

                        <StackPanel Orientation="Vertical" Margin="2">
                            <TextBlock Style="{StaticResource BasicTextStyle}" Margin="3,3,3,-15" HorizontalAlignment="Center" Text="Background update frequency (minutes)"/>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="30"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="30"/>
                                </Grid.ColumnDefinitions>
                                <TextBlock Grid.Column="0" Margin="3" Text="{Binding Minimum, ElementName=refreshFreqSlider}" 
                                       Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Right" VerticalAlignment="Bottom"/>
                                <Slider Grid.Column="1" Margin="3" Height="30" Minimum="15"   x:Name="refreshFreqSlider"
                                    Value="{Binding Mode=TwoWay, Path=RefreshFrequencyMinutes}"
                                    Maximum="60" Foreground="Blue" />
                                <TextBlock Grid.Column="2" Margin="3" 
                                       Text="{Binding Maximum, ElementName=refreshFreqSlider}" Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Left" VerticalAlignment="Bottom"/>
                            </Grid>
                        </StackPanel>
                    </Border>
                    <Border CornerRadius="3" BorderThickness=".5" BorderBrush="Blue"  Margin="2,10,2,10">

                        <StackPanel Orientation="Vertical" Grid.Row="1" Margin="2">
                            <TextBlock Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Center" 
                                   Text="Ignore items older than (days)"  Margin="3,3,3,-15"/>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="30"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="30"/>
                                </Grid.ColumnDefinitions>
                                <TextBlock Grid.Column="0" Margin="3" Text="{Binding Minimum, ElementName=deleteAgeSlider}" 
                                       Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Right" VerticalAlignment="Bottom"/>
                                <Slider Grid.Column="1" Margin="3" Height="30" Minimum="5"  x:Name="deleteAgeSlider"
                                    Value="{Binding Mode=TwoWay, Path=DeleteItemsOlderThanDays}"
                                    Maximum="25" Foreground="Blue" />
                                <TextBlock Grid.Column="2" Margin="3" 
                                       Text="{Binding Maximum, ElementName=deleteAgeSlider}" Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Left" VerticalAlignment="Bottom"/>
                            </Grid>
                        </StackPanel>
                    </Border>
                   
                </StackPanel>
            </Grid>
        </Grid>
    </Border>
</local:LayoutAwarePage>